import { MyVue } from 'src/wl/my_vue';
import Vue from 'vue';
import { Component, Emit, Prop, Provide, Watch } from 'vue-property-decorator'
import { WebManageConst } from "src/consts/web_manage_const";
import { PopupName } from "src/consts/popup_const";

@Component({})
export default class AuditTBusinessPanel extends MyVue {
    name: string = 'MemberPanel';
    formData: any;
    footerFlag: boolean = true;
    fileList: any[];
    action: String;
    input: String;

    beforeCreate(): void {
    }

    initData(that?: any): void {
        that.formData = {}
        that.fileList = []
        that.action = Config.ajaxUrl + "/website/upload.do"
        that.input = ""
    }

    mounted(): void {
    }

    doDown(): void {
        // window.open("static/moban/muban.xlsx", "download")
    }

    submitUpload(): void {
        this.$refs.upload.submit();

    }

    doSuccess(response: any, file: any, fileList: any): void {
        // console.log("response", response, 2, file, 3, fileList)
        if (response.code == 0) {
            let sendData: any = {}
            sendData["curr_page"] = WLStore().state.webManage.curr_page
            sendData["page_size"] = WLStore().state.webManage.page_size
            WLDispatch(WebManageConst.DispatchWebMList, sendData);
            WLMessage("文件上传成功", "success")
            WLLib.panel(PopupName.WebM_UpLoad_Panel).close()
        } else {
            WLMessage("文件内容有错或重复,请重新上传", "warning")
        }
    }

    doErr(err: any, file: any, fileList: any): void {
        // console.log("doErr", err, 2, file, 3, fileList)
    }

    doProgress(file: any, fileList: any): void {
        if (fileList.length > 1) {
            fileList.splice(0, 1)
        }
        console.log("doProgress", file, 2, fileList)
        this.input = file.name
    }

    beforeRemove(file: any, fileList: any): any {
        return this.$confirm(`确定移除 ${file.name}？`);
    }
}